import { Suspense } from "react";
const Power = ({ ele, path }) => {
  let power = JSON.parse(sessionStorage.getItem("power"));
  // console.log(power);
  for (let i = 0; i < power.length; i++) {
    if (power[i].link.indexOf(path) !== -1) {
      return (
        <>
          <Suspense fallback={<div>loading</div>}>{ele}</Suspense>
        </>
      );
    }
  }

  return (
    <>
      <h1>没有权限访问</h1>
    </>
  );
};
export default Power;
